package com.example.myapplication3;

import android.content.Context;
import android.view.View;
import android.widget.Toast;

public class ExternalClickListener implements View.OnClickListener {
    private final Context context;

    // 构造函数，接收上下文用于显示 Toast
    public ExternalClickListener(Context context) {
        this.context = context;
    }

    @Override
    public void onClick(View v) {
        Toast.makeText(context, "外部类监听器触发", Toast.LENGTH_SHORT).show();
    }
}